package com.school.repair.service;

import com.school.repair.dao.RepairManDao;
import com.school.repair.dao.RepairunitDao;
import com.school.repair.entity.RepairMan;
import com.school.repair.entity.Repairunit;
import com.school.repair.util.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RepairunitService {

    @Resource
    RepairunitDao repairunitDao;

    @Resource
    RepairManDao repairManDao;

    public Page<Repairunit> repairList(int pageNo, int pageSize, String uname, String linktel, String linkman) {
        List<Repairunit> list = repairunitDao.repairList(pageNo, pageSize, uname, linktel, linkman);
        int total = repairunitDao.repairListTotal(uname, linktel, linkman);
        return new Page<Repairunit>(total, list, pageNo);
    }

    public int repairunitAdd(Repairunit unit) {
        return repairunitDao.repairunitAdd(unit);
    }

    public Repairunit repairunitFind(long id) {
        return repairunitDao.repairunitFind(id);
    }

    public int repairunitUpdate(String uname, String addr, String linkman, String linktel, String zhizhao, String creator, long id) {
        return repairunitDao.repairunitUpdate(uname, linktel, linkman, addr, zhizhao, creator, id);
    }

    public int deleteById(long id) {
        return repairunitDao.deleteById(id);
    }


    public RepairMan findRepairMan(long id) {
        return repairManDao.findRepairMan(id);
    }


    public int adminUpdateRepairMan(RepairMan rm) {
        return repairManDao.adminUpdateRepairMan(rm);
    }

    public int delRepair(long id) {
        return repairManDao.delRepair(id);
    }
}
